import {Component, OnInit} from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http'

@Component({
  selector: 'app-myc04-httpfetchshop',
  templateUrl: './myc04-httpfetchshop.component.html',
  styleUrls: ['./myc04-httpfetchshop.component.css']
})
export class Myc04HttpfetchshopComponent implements OnInit {

  res: any
  constructor(private http: HttpClient) {
  }

  ngOnInit(): void {
  }

  loadProduct() {
    let url = "http://localhost:8080/admin/list?pageNum=1&pageSize=100"

    let headerOption = { headers: new HttpHeaders({ "Authorization": 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImNyZWF0ZWQiOjE2MzM2MTgwNTMzMTYsImV4cCI6MTYzNDIyMjg1M30.4yQ-NU0z38eifHxAFdeS3YqC7B-TZtEA7OVvuc81kHPJoWKnhjj2OFgz2uHhMfcqKGE-0iFUT8rYYvnC4-1Mtw'})}

    this.http.get(url, headerOption).subscribe((res: any) => {
      this.res = res
      console.log(this.res)
    })
  }
}
